﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace LyyCMS.Migrations
{
    public partial class addusers : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "UserId",
                table: "Blogs",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "Users",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserName = table.Column<string>(nullable: false),
                    UserPass = table.Column<string>(nullable: false),
                    Email = table.Column<string>(nullable: true),
                    QQ = table.Column<string>(nullable: true),
                    UserType = table.Column<int>(nullable: false),
                    UserState = table.Column<int>(nullable: false),
                    Crete_At = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Users", x => x.Id);
                });

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "Create_At", "UserId" },
                values: new object[] { new DateTime(2019, 10, 16, 18, 2, 55, 904, DateTimeKind.Local).AddTicks(771), 1 });

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "Create_At", "UserId" },
                values: new object[] { new DateTime(2019, 10, 16, 18, 2, 55, 904, DateTimeKind.Local).AddTicks(771), 1 });

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 1,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 18, 2, 55, 905, DateTimeKind.Local).AddTicks(772));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 2,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 18, 2, 55, 905, DateTimeKind.Local).AddTicks(772));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 3,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 18, 2, 55, 905, DateTimeKind.Local).AddTicks(772));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 4,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 18, 2, 55, 905, DateTimeKind.Local).AddTicks(772));

            migrationBuilder.InsertData(
                table: "Users",
                columns: new[] { "Id", "Crete_At", "Email", "QQ", "UserName", "UserPass", "UserState", "UserType" },
                values: new object[] { 1, new DateTime(2019, 10, 16, 18, 2, 55, 899, DateTimeKind.Local).AddTicks(769), null, null, "Admin", "Admin", 1, 1 });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Users");

            migrationBuilder.DropColumn(
                name: "UserId",
                table: "Blogs");

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 1,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 9, 6, 6, 672, DateTimeKind.Local).AddTicks(6582));

            migrationBuilder.UpdateData(
                table: "Blogs",
                keyColumn: "Id",
                keyValue: 2,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 9, 6, 6, 676, DateTimeKind.Local).AddTicks(6584));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 1,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 9, 6, 6, 691, DateTimeKind.Local).AddTicks(6593));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 2,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 9, 6, 6, 691, DateTimeKind.Local).AddTicks(6593));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 3,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 9, 6, 6, 691, DateTimeKind.Local).AddTicks(6593));

            migrationBuilder.UpdateData(
                table: "Comments",
                keyColumn: "Id",
                keyValue: 4,
                column: "Create_At",
                value: new DateTime(2019, 10, 16, 9, 6, 6, 691, DateTimeKind.Local).AddTicks(6593));
        }
    }
}
